/****** Object:  Stored Procedure [dbo].spproductInsert Script Date: 11/24/2012 ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[spproductInsert]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spproductInsert]
GO

/******************************************************************************
**		Name: [dbo].spproductInsert
**		Desc:
**
**		Return values:
**
**		Called by:
**
**		Parameters:
**		Input						Output
**		----------					----------
**
**		Auth: MinhSong
**		Date: 11/24/2012
*******************************************************************************
**		Change History
*******************************************************************************
**		Date:		Author:					Description:
**		--------	--------				-----------------------------------
**
*******************************************************************************/

CREATE PROCEDURE [dbo].[spproductInsert]
(
	@ProductName nvarchar(50),
	@ProductImage nvarchar(100),
	@ProductDesc text,
	@Weight int,
	@Height int,
	@Long int,
	@Wide int,
	@CreateBy nvarchar(50),
	@UpdateBy nchar(50),
	@Price real,
	@Stock int,
	@Unit nvarchar(50),
	@ProductID int output
)
WITH ENCRYPTION

AS

SET NOCOUNT ON

INSERT INTO [tbl_product]
(
	[ProductName],
	[ProductImage],
	[ProductDesc],
	[Weight],
	[Height],
	[Long],
	[Wide],
	[CreateBy],
	[CreateDate],
	[UpdateBy],
	[UpdateDate],
	[Price],
	[Stock],
	[Unit]
)
VALUES
(
	@ProductName,
	@ProductImage,
	@ProductDesc,
	@Weight,
	@Height,
	@Long,
	@Wide,
	@CreateBy,
	getdate(),
	@UpdateBy,
	getdate(),
	@Price,
	@Stock,
	@Unit
)

SELECT @ProductID = SCOPE_IDENTITY()
--SELECT @Id = @@IDENTITY
GO

--GRANT EXECUTE ON [dbo].[spproductInsert] TO [sa]
--GO
